﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ImageRecognition2.Forms
{
    /// <summary>
    /// This will give you a hint of image informations,
    /// like size, color depth and other ones
    /// </summary>
    public partial class FormImageInfo : Form
    {
        protected Image m_Image = null;

        /// <summary>
        /// Initializes a new instance of the <see cref="FormImageInfo"/> class.
        /// </summary>
        public FormImageInfo()
            : this(null)
        {
            this.Activated += delegate(object sender, EventArgs e)
            {
                ShowImageProperties();
            };

            this.Shown += delegate(object sender, EventArgs e)
            {
                ShowImageProperties();
            };
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FormImageInfo"/> class.
        /// </summary>
        /// <param name="_image">The _image.</param>
        public FormImageInfo(Image _image)
        {
            InitializeComponent();
            m_Image = _image;
            ShowImageProperties();
        }

        /// <summary>
        /// Shows the image properties.
        /// </summary>
        protected void ShowImageProperties()
        {
            this.propertyGridImageInfo.SelectedObject = m_Image;
            this.propertyGridImageInfo.Update();
        }
    }
}
